/**
 * @author - lhn
 * @version - 1.0.0
 * @description - 权限相关接口
 * @file - IAuthority.ts
 * @datetime - 2025/2/28
 * @editor - lhn
 */


interface IAuthority {
  /** 权限类型 */
  authorityType: IAuthorityType;

  /**
   * 权限的切换
   * @param {number} author - 权限
   * @param {number} type - 切换的权限类型
   * @returns {number} - 切换后的权限
   * */
  permissionSwitching: (author: number, type: number) => number;


  /**
   * 权限的判断
   * @param {number} author - 权限
   * @param {number} type - 判断的权限类型
   * @returns {boolean} - 是否有权限
   * */
  permissionJudgment: (author: number, type: number) => boolean;
}


/* ------------------------------------------------------------------------------------------------------------------ */


type IAuthorityType = {
  READ: 0b1,  // 0001 读
  WRITE: 0b10,  // 0010 写
  UPDATE: 0b100,  // 0100 更新
  DEL: 0b1000,  // 1000 删除
}


/* ------------------------------------------------------------------------------------------------------------------ */


export type {
  IAuthority,
  IAuthorityType
};